Google Cloud AI Services Quick Start Guide by Arvind Ravulavaru
Author:Arvind Ravulavaru
Language: eng
Format: epub
Tags: COM004000 - COMPUTERS / Intelligence (AI) and Semantics, COM018000 - COMPUTERS / Data Processing, COM044000 - COMPUTERS / Neural Networks
Publisher: Packt Publishing
Published: 2018-05-30T06:10:19+00:00
Creating the Vision API service
To upload the image to our server, we are using postFile() on VisionAPIService. Let's create this service now. Inside the client\app\services folder, create a file named vision.api.service.ts and update it as follows:
// SNIPP SNIPP
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class VisionAPIService {
constructor(private http: HttpClient) {}
postFile(threadId: string, fileToUpload: File): Observable < any > {
const formData: FormData = new FormData();
formData.append('image-reply', fileToUpload, fileToUpload.name);
return this.http.post < any > (`/api/upload-image/${threadId}`, formData);
}
}
// SNIPP SNIPP
We need to add this service as a provider in client\app\app.module.ts. First, we will import VisionAPIService into client\app\app.module.ts:
// SNIPP SNIPP
import { VisionAPIService } from './services/vision.api.service';
// SNIPP SNIPP
Update the providers as follows:
// SNIPP SNIPP
providers: [
AuthService,
AuthGuardLogin,
AuthGuardAdmin,
UserService,
ThreadService,
MessageService,
VisionAPIService,
{
provide: HTTP_INTERCEPTORS,
useClass: TokenInterceptor,
multi: true
}
],
// SNIPP SNIPP
Save all the files to continue.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8310)
Test-Driven Development with Java by Alan Mellor(6826)
Data Augmentation with Python by Duc Haba(6741)
Principles of Data Fabric by Sonia Mezzetta(6485)
Learn Blender Simulations the Right Way by Stephen Pearson(6395)
Microservices with Spring Boot 3 and Spring Cloud by Magnus Larsson(6258)
Hadoop in Practice by Alex Holmes(5966)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5816)
RPA Solution Architect's Handbook by Sachin Sahgal(5656)
Big Data Analysis with Python by Ivan Marin(5409)
The Infinite Retina by Robert Scoble Irena Cronin(5347)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5162)
Pretrain Vision and Large Language Models in Python by Emily Webber(4378)
Infrastructure as Code for Beginners by Russ McKendrick(4146)
Functional Programming in JavaScript by Mantyla Dan(4044)
The Age of Surveillance Capitalism by Shoshana Zuboff(3964)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3860)
Embracing Microservices Design by Ovais Mehboob Ahmed Khan Nabil Siddiqui and Timothy Oleson(3660)
Applied Machine Learning for Healthcare and Life Sciences Using AWS by Ujjwal Ratan(3636)
